package demo01;

import java.util.Date;

public class Main {
    public static void main(String[] args) throws CloneNotSupportedException{
        Date date = new Date();
        System.out.println("此时是浅复制");
        Video work1 = new Video("我是正版",date);
        System.out.println("work1=>"+work1);
        System.out.println("work=>2"+work1.hashCode());


        Video work2 = (Video) work1.clone();
        System.out.println("work2=>"+ work2);
        System.out.println("work2=>"+ work2.hashCode());
        System.out.println("修改work2的时间work1也会改变，因为它们指向的是同一个引用");
        System.out.println("=================================");
        work2.setName("我是盗版");
        date.setTime(39893189);
        work2.setCrateTime(date);
        System.out.println("work2=>"+ work2);
        System.out.println("work2=>"+ work2.hashCode());
        System.out.println("work1=>"+work1);
        System.out.println("work=>2"+work1.hashCode());
    }
}